/**
* 平台基本类
* 最基本 属性 的 定义
*/
Yacon.Component = function(){
	
	
	this.classID      = "";
	this.classType    = "";
	this.className    = "";
	this.classAddress = "";
	this.element       = "";
	this.elementType   = null;
	this.attach        = null;
	this.attachControl = null;
	this.classParent  = Object;

};

Yacon.Component.Extend(Object,{
			
		create:function()
		{
					
		},
		setClassID:function(fid)
		{
			this.classID = fid;	
		},
		getClassID:function()
		{
			return this.classID;			
		},		
		getClassType:function()
		{
			return this.classType;			
		},		
		getClassName:function()
		{
			return this.className;			
		},
		getClassAddress:function()
		{
			return this.classAddress;			
		},
		addComponents:function(Component)
		{
			
		},
		setConText:function(conText)
		{
			Yacon.apply(this,conText);
		},	
		addEvents:function(eventName,eventHander)
		{
		 	Yacon.addEvents(this.element,eventName,eventHander);
		},	
		getStyle:function(styleName)
		{
	    	if(this.element)
	    		return  this.element.style.getAttribute(styleName);
	    	else
	    		return "";
		},
	    setStyle:function(styleName,styleValue)
		{
	    	if(this.element)
	    	{
	    		eval("this.element.style."+styleName+"=\""+styleValue+"\"");
	    	}
	    	   	
		},
	
	    addAttr:function(attrName,attrValue)
		{
	    	if(this.element){
	    		if(Yacon.isBootstrap()){
	    			this.element.attr(attrName.toLowerCase(),attrValue);
	    		}else{
	    			this.element.setAttribute(attrName,attrValue);  
	    		}
	    		
	    	}		  	
		},	
	
	    getAttr:function(attrName)
		{
	    	if(this.element){
	    		if(Yacon.isBootstrap()){
	    			return this.element.attr(attrName.toLowerCase());
	    		}else{
	    			return this.element.getAttribute(attrName);  
	    		}
	    	}
	    	else
	    		return "";
		},	
		createElement:function(tag)
		{
			var element = document.body.createElement(tag);
			document.body.appendChild(element);
			/*document.body.appendChild(child.element);*/
			return element;
		},
		getAbsPos:function(element)
		{
			
			var element = (element)?element:this.element;
			if (!element)
				element = this.attach;
					
			return Yacon.getAbsPosition(element);
		},
		getAttachID:function()
		{
			if (this.attach)
				return this.attach.getAttribute("id");
			else
				return "";
		},
		getAttach:function()
		{
			return this.attach ;
		},
		setAttach:function(element)
		{
			if(Yacon.isElement(element))
			{
				this.attach = element;
			}else if(Yacon.isObject(element))
			{
				this.attach = element.element;		
			}else if(Yacon.isString(element))
			{
				this.attach = document.getElementById(element);
			}		
			return this.attach ;
		},
		getAttachControl:function()
		{
			return this.attachControl ;
		},
		setAttachControl:function(element)
		{
			if(Yacon.isElement(element))
			{
				this.attachControl = element.Control;
			}else if(Yacon.isObject(element))
			{
				this.attachControl = element;		
			}else if(Yacon.isString(element))
			{
				if (document.getElementById(element))
					this.attachControl = document.getElementById(element);
			}		
			return this.attachControl ;
		},	
		
		
		getPath:function(path)
		{
			if (path == undefined ||path.trim().isEqual(""))
				path = "/";
			if (!path.substr(0,1).isEqual("/"))
				path = "/" + path;	
			
			return this.getContextPath()+ path
		},
		getContextPath:function()
		{
			return window.contextPath;			
		},
		isOpera:function()
		{
			return window.isOpera;
		},
		isChrome:function()
		{
			return window.isChrome;
		},
		isWebKit:function()
		{
			return window.isWebKit;
		},
		isSafari:function()
		{
			return window.isSafari;
		},
		isIE:function()
		{
			return window.isIE;
		},
		isIE11:function()
		{
			return window.isIE11;
		},
		isGecko:function()
		{
			return window.isGecko;
		},
		destroy:function()
		{
			delete this;
		}
});

